package com.yhao.stocknew.controller;


import com.yhao.stocknew.common.service.SHService;
import com.yhao.stocknew.common.utils.DateUtil;
import com.yhao.stocknew.entity.StockInfo;
import com.yhao.stocknew.mapper.StockInfoMapper;
import com.yhao.stocknew.service.HisInfoService;
import com.yhao.stocknew.service.StockInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 历史信息表 前端控制器
 * </p>
 *
 * @author yhao
 * @since 2023-12-15
 */
@RestController
@RequestMapping("/hisInfo")
public class HisInfoController {


    @Autowired
    private SHService shService;

    @Autowired
    private StockInfoMapper stockInfoMapper;

    @GetMapping("/getHistData")
    public String getHistData() {
        String startDate = "20150101";
        String endDate = "20231215";
        final List<StockInfo> allInfos = stockInfoMapper.getAllInfos();
        for (StockInfo stockInfo : allInfos) {
            shService.getHisInfo(stockInfo.getdCode(), stockInfo.getdName(), startDate, endDate);
        }
        return "success";
    }

}
